package com.supkong.java.lambda;

import cn.hutool.core.io.FileUtil;

import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;

/**
 * @program: jdk8-learning-example
 * @author: Kong
 * @create: 2020-04-10 15:30
 * @description:
 */
public class Test {
    public static void main(String[] args) {
        Runnable r1 = () -> System.out.println("123");
        r1.run();
        try {
            String oneline = processFile((BufferedReader br) -> {
                try {
                    return br.readLine();
                } catch (IOException e) {
                    e.printStackTrace();
                }
                return null;
            });
            System.out.println(oneline);
        }catch (Exception e){
            e.printStackTrace();
        }

    }

    public static String processFile(BufferedReaderProcessor p)  {
        BufferedReader br = null;
        try {
            System.out.println("|-----in、");
            br = new BufferedReader(new FileReader(Test.class.getResource("").getPath()+"Test.class"));
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        }
        return p.process(br);
    }

}
